package com.health.viewscontrols.qyinfo;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;

import com.health.R;
import com.health.adapter.FragmentAdapter;
import com.health.fragment.focusgroup.GXY_SfFragment;
import com.health.fragment.jtys.JTYSDA;
import com.health.tools.GlobalConts;
import com.health.tools.GlobalContsJTYS;
import com.health.viewscontrols.NovaFragmentActivity;
import com.health.viewscontrols.PersonalFileActivity.onFragmentSave;
import com.novabluetooth.views.ExamHistoryActivity;

import java.util.ArrayList;

/**
 * 选择 人员
 * 
 * @author nova
 *
 */
public class MemberDataActivity extends NovaFragmentActivity implements OnClickListener {

	private ViewPager viewPager;
	private ArrayList<Fragment> fragments;

	private TextView title;
	private Button btn_back;
	public static Button btn_up;
	FragmentAdapter adapter;
	public static Activity mGXYActivity = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.member_data_choose);
		initView();
		addListener();
	}

	private void initView() {
		title = (TextView) findViewById(R.id.title);

		btn_back = (Button) findViewById(R.id.btn_back);
		btn_up = (Button) findViewById(R.id.btn_up);
		btn_up.setVisibility(View.GONE);
		viewPager = (ViewPager) findViewById(R.id.viewpager);


		Fragment baseFragement = new JTYSDA();
		//家庭医生档案 界面复用，需要传值 确定复用界面
		Bundle bundle = new Bundle();
		bundle.putString(GlobalContsJTYS.FRAGMENT_MEMBER_INTENT_ID, GlobalContsJTYS.FRAGMENT_MEMBER_INTENT_ID_MEMBER);
		baseFragement.setArguments(bundle);


		fragments = new ArrayList<Fragment>();
		fragments.add(baseFragement);

		adapter = new FragmentAdapter(getSupportFragmentManager(), fragments);
		viewPager.setAdapter(adapter);
		title.setText("选择家庭关系");
		setChecked(0);

		mGXYActivity = this;
	}

	private void addListener() {

		viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
			@Override
			public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

			}

			@Override
			public void onPageSelected(int position) {
				setChecked(position);
			}

			@Override
			public void onPageScrollStateChanged(int state) {

			}
		});

		btn_back.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {

		int id = v.getId();
		if (id == R.id.sf_info_base) {
			viewPager.setCurrentItem(0);
			setChecked(0);
		} else if (id == R.id.btn_back) {
			this.finish();
		}  else {
		}

	}


	@SuppressLint("ResourceAsColor")
	private void setChecked(int pos) {

	}
}
